<?php

class Right
{
	public $handle;
	public $name;
	public $description;
	public $allows;
	
	public function __construct($handle, $name, $description=null)
	{
		$this->allows = array();
		
		$this->handle = $handle;
		$this->name = $name;
		$this->description = $description;
	}
	
	/**
	 * Add a allow for the current right and returns 
	 * the right afterwards.
	 *
	 * @param string $controller
	 * @param string $action
	 * @return Right
	 */
	public function allow($module=null, $controller=null, $action=null)
	{
		$this->allows[] = array( "module" => $module, 
		                         "controller" => $controller, 
		                         "action" => $action);
		return $this;
	}
	
}